<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />

<script type="text/javascript" src="http://cdn.robotwebtools.org/EventEmitter2/current/eventemitter2.min.js"></script>
<script type="text/javascript" src="http://cdn.robotwebtools.org/roslibjs/current/roslib.min.js"></script>
<!--
<script type="text/javascript" src="http://chimek.yujinrobot.com/rosjs/interactions.js"></script>
-->
<script type="text/javascript" src="http://robotics-in-concert.github.io/rocon_tools/js/hydro/interactions.js"></script>
<script type="text/javascript" type="text/javascript">

  console.log("Display Name : " + rocon_interactions.display_name)
  console.log("Rosbridge URI: " + rocon_interactions.rosbridge_uri)
  console.log("Parameters   : " + JSON.stringify(rocon_interactions.parameters))
  console.log("Remappings   : " + JSON.stringify(rocon_interactions.remappings))
 
  // Connecting to ROS
  // -----------------
  var ros = new ROSLIB.Ros({
    url : rocon_interactions.rosbridge_uri
    //url : 'ws://localhost:8080'
  });

  // Subscribing to a Topic
  // ----------------------
  var topic_name = '/chatter'
  if (topic_name in rocon_interactions.remappings)
    topic_name = rocon_interactions.remappings[topic_name]
  var listener = new ROSLIB.Topic({
    ros : ros,
    name : topic_name,
    messageType : 'std_msgs/String'
  });

  listener.subscribe(function(message) {
    console.log('Received message on ' + listener.name + ': ' + message.data);
    listener.unsubscribe();
  });
</script>
</head>

<body>
  <h1>Rocon Interactions Listener Demo</h1>
  <p>Check your Web Console for output (hit F12 in google chrome).</p>
</body>
</html>
